<%@ Page Language="C#" MasterPageFile="~/MasterPages/Learning.Master" AutoEventWireup="true" CodeBehind="UnitTesting.aspx.cs" Inherits="Mindscape.BackgroundMotion.Website.Learn.UnitTesting" Title="Code: Learn about Unit Testing" %>
<asp:Content ID="Content3" ContentPlaceHolderID="BodyContent" runat="server">

    <h2>Unit Testing</h2>
    
    <p>
    Unit testing is a procedure used to validate that individual units of source code are working properly. Rather than using humans to do this testing,
    we can draw on automated tools and frameworks to write code that tests our system and validates a set of assertions
    around state changes or interactions between components.<br />
    <br />
    Simply put, automated unit tests are:
    </p>
    
    <ul>
        <li>Structured</li>
        <li>Self-documenting</li>
        <li>Automatic and repeatable</li>
        <li>Based on known data</li>
        <li>Designed to test positive and negative actions</li>
        <li>Ideal for testing implementation across different machines</li>
        <li>Examples of configuration, implementation, and execution</li>
    </ul>
    
    <p>
    Some of the key benefits of applying unit testing are:
    </p>
    
    <ul>
        <li>It helps facilitate change through refactoring</li>
        <li>Simplified integration by allowing a bottom up style of development</li>
        <li>Tests become a documentation artifact helping to show valid assertions about system behavior</li>
    </ul>
    
    <p>
    With BackgroundMotion we used unit tests to help assert our knowledge of the system we were building and also
    give us confidence that as we were evolving the system that those assertions held true. Rather than going through
    longer build and test cycles we were able to receive more immediate feedback about the state of the system as a whole.
    </p>
    
    <br />
    <div align="center">
        <a href="/Learn/PlayVideo.aspx?v=Nugget8" target="page" onClick="window.open('','page','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=450,height=350,titlebar=yes')"><img border="0" src="/Images/Dev/VideoNugget8.jpg" /></a><br />
        <p>Andrew describes the approach we took with Unit Testing on BackgroundMotion</p>    
    </div>
    <br />
    
    <h2>Unit Testing with .NET</h2>
    
    <p>
    On BackgroundMotion we used a unit testing framework called NUnit.<br />
    <br />
    <i>"NUnit is a unit-testing framework for all .Net languages. Initially ported from JUnit, the current production release, version 2.4, is the fifth major release of this xUnit based unit testing tool for Microsoft .NET. It is written entirely in C# and has been completely redesigned to take advantage of many .NET language features, for example custom attributes and other reflection related capabilities. NUnit brings xUnit to all .NET languages."</i><br />
    <a href="http://www.nunit.org/">http://www.nunit.org/</a>
    <br />
    <br />
    Alternative if you have Visual Studio 2005 Team Developer or Team Tester Editions you can use the integrated unit testing framework which is included with those editions.
    </p>
        
    <h2>Where can I find more information?</h2>

    <ul>
        <li>Learn about <a href="http://msdn2.microsoft.com/en-us/library/ms243147(VS.80).aspx">Unit Testing in Visual Studio 2005</a></li>
        <li><a href="http://msdn2.microsoft.com/en-us/library/aa302183.aspx">Enabling Better Software through Better Testing</a></li>
        <li><a href="http://www.nunit.org/">NUnit Home Page</a></li>
        <li>Run your tests easily with <a href="http://www.testdriven.net">TestDriven.NET</a></li>
    </ul>    
    
</asp:Content>
